import util from "utils/util";
//税票查询订阅通知
export function openReportSubscribe() {
  let tmplIds = ["OxJBDS7aB_tRsyt_yT5GXw2MXvpLBK07quyfinGwybE"];
  return subscribe(tmplIds);
}

//意见反馈订阅通知
export function openFeedbackSubscribe() {
  let tmplIds = ["P083HM8Y3bpNIVX2t2gKCjTDsind3VPE8dZCiRf69-A"];
  return subscribe(tmplIds);
}

//企业类型订阅通知

export function openEnterpriseTypeSubscribe() {
  let tmplIds = ["JYVxnsQ4GNqQIXPZukBkTmtxSOBwVvrGtCB6oqk8NZE"];
  return subscribe(tmplIds);
}

// 提现通知
export function openGrabSubscribe() {
  const tmplIds = ['32dGQxYxfg8UyhigPpuooVFtOMgmG03ZJqxlSklIylQ']
  return subscribe(tmplIds)
}

// 奖励通知
export function openRewardSubscribe() {
  const tmplIds = ['hO6qYhs7qz1zq5i0zxhobTcy1SWLj7cO1HGz2roRaO0']
  return subscribe(tmplIds)
}

/**
 * 调起订阅界面
 * array tmplIds 模板id
 */
export function subscribe(tmplIds) {
  let wecaht = wx;
  return new Promise((reslove, reject) => {
    wecaht.requestSubscribeMessage({
      tmplIds: tmplIds,
      success(res) {
        console.log("订阅成功", res);
        return reslove(res);
      },
      fail(res) {
        console.log("订阅失败", res);
        return reslove(res);
      },
    });
  });
}
